<%@ page contentType="text/html;charset=utf-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <title>保安员查询</title>
    <link type="text/css" href="<c:url value='/resource/wx/newcss/common.css'/>" rel="stylesheet"/>
    <style type="text/css">
        .main {
            font-size: 1.6em;
            margin: 8px;
        }
        .main .form {
            height: 50px;
            line-height: 50px;
            border: 1px solid #dddddd;
            width: 100%;
            border-top: 0;
        }
        .main .boder-top {
            border-top: 1px solid #dddddd
        }
        .border_top_radius {
            border-top-left-radius: 3px;
            border-top-right-radius: 3px;
        }
        .border_bottom_radius {
            border-bottom-left-radius: 3px;
            border-bottom-right-radius: 3px;
        }
        .main .form .label {
            height: 50px;
            line-height: 50px;
            color: #157dfb;
            text-indent: 0.8em;
            float: left;
            width: 100px;
        }
        .main .form .element {
            height: 50px;
            line-height: 50px;
            margin-left: 105px;
            display: block;
        }
        .main .form .element input {
            color: #666;
            font-family: "微软雅黑", serif;
            text-indent: 0.3em;
            border: 0;
            width: 98%;
            font-size: 1.0em;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
        .main .btn:active {
            background-color: #3300ff;
            cursor: hand;
        }
        #result {
            min-height: 6em;
            margin: 0 10px;
            line-height: 2;
            height: 2em;
            color: #837d7d;
        }
        .tab_title {
            height: 33px;
            border: 1px solid #157dfb;
            border-radius: 6px;
            background-color: #157dfb;
        }

        .tab_title .tab_item {
            width: 50%;
            display: inline-block;
            float: left;
            text-align: center;
            height: 33px;
            line-height: 33px;
            color: #706C6C;
            font-size: 1.6em;
            cursor: hand;
            background-color: #fff;
        }

        .tab_title .checked {
            background-color: transparent;
            color: #fff;
        }

        .tab_title .tab_left {
            border-top-left-radius: 5px;
            border-bottom-left-radius: 5px;
        }

        .tab_title .tab_right {
            border-top-right-radius: 5px;
            border-bottom-right-radius: 5px;
        }
        .title-bar {
            border: none;
            top: 0;
            height: 2.6em;
            line-height: 2.6em;
            text-indent: 0.4em;
            width: 100%;
            font-size: 1.8em;
            font-weight: 500;
            color: #eaeaea;
            background-color: #000000;
            display: -webkit-box;
            z-index: 999;
        }

        .title-bar .title {
            background-color: #17b4eb;
            -webkit-box-flex: 1;
            text-align: center;
            display: block;
        }

        .title-bar .btn-back {
            background-color: #17b4eb;
            border-top-left-radius: 0.7em;
            display: block;
            width: 3.0em;
            border-right: 1px solid rgba(197, 238, 220, 0.67);
        }

        .title-bar .btn-oper {
            border-top-right-radius: 0.7em;
            background-color: #17b4eb;
            display: block;
            width: 3.0em;
            text-align: center;
            width: -webkit-fit-content;
            min-width: 3.0em;
        }
    </style>
</head>
<body>
</div>
<div class="main">
    <div class="form searchbom border_top_radius boder-top">
        <span class="label">身份证号：</span>
        <span class="element"><input id="idcard_case" class="no-border" type="text" maxlength="18" placeholder="请输入身份证号"/></span>
    </div>
    <div class="form searchtop border_bottom_radius">
        <span class="label">姓&nbsp;&nbsp;&nbsp;&nbsp;名：</span>
        <span class="element"><input id="name_case" class="no-border" type="text" maxlength="10" placeholder="请输入姓名"/></span>
    </div>
    <div><button id="btn_query" class="btn simple no-border">查 询</button></div>
    <div id="result" style="display: none;">
        <div>
            <span>身份证号码：</span>
            <span id="gmsfhm"></span>
        </div>
        <div>
            <span>保安员编码：</span>
            <span id="bayzbm"></span>
        </div>
        <div>
            <span>保安员等级：</span>
            <span id="baydjdm"></span>
        </div>
        <div>
            <span>发证机关代码：</span>
            <span id="ffgajgdm"></span>
        </div>
        <div>
            <span>发证机关名称：</span>
            <span id="ffgajgmc"></span>
        </div>
    </div>
</div>
<script type="text/javascript" src="<c:url value='/resource/wx/js/jquery-2.1.1.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/resource/wx/js/common.js'/>"></script>
<script type="text/javascript">

    $(function () {


        $("#btn_query").click(function () {
            var idCard = $("#idcard_case").val().trim();
            var name = $("#name_case").val().trim();
            if (idCard == null || idCard == "" || !(idCard.length==15 || idCard.length==18)) {
                toast("请输入正确的身份证号");
                return;
            }
            /*var idCardFormat = /[0-9]{18}/;
            if(!idCardFormat.test(idCard)){
                toast("请输入18位身份证号", 1500);
                return false;
            }*/
            if (name == null || name == "") {
             toast("请输入保安员姓名");
             return;
             }
            $.ajax({
                url: "<c:url value='/api/query/bay/info'/>",
                type: "post",
                timeout: 6000,
                data: {"idCard": idCard,"name":name},
                beforeSend: function () {
                    loading("正在查询...");
                },
                success: function (data) {
                    if (data && data.succ) {
                        $("#gmsfhm").html(data.data.gmsfhm);
                        $("#bayzbm").html(data.data.bayzbm);

                        var baydjdm = data.data.baydjdm;
                        var baydj;
                        if (baydjdm == "10") {
                            baydj = "初级保安员";
                        } else if (baydjdm == "20") {
                            baydj = "中级保安员";
                        }
                        else if (baydjdm == "30") {
                            baydj = "高级保安员";
                        }
                        else if (baydjdm == "40") {
                            baydj = "表示保安师";
                        }
                        $("#baydjdm").html(baydj);
                        $("#ffgajgdm").html(data.data.ffgajgdm);
                        $("#ffgajgmc").html(data.data.ffgajgmc);
                        $("#result").show();
                        finish();
                    } else {
                        finish("没有查询到相应的数据");
                    }
                },
                error: function () {
                    $("#result").hide();
                    finish("查询失败");
                }
            });
            return false;
        });
    });

</script>
</body>
</html>
